<template>
  <div class="father">
    父亲
    <div>车: {{ car }}</div>
    <div v-show="toy">来自儿子的玩具 {{ toy }}</div>
<!--    也能将sendToy当成函数送给子组件调用传值给父亲-->
<!--    例如:send-toy="sendToy"-->
<!--    <son :car="car" :send-toy="getToy" />-->
<!--    <son :car="car" @send-toy="getToy" />-->
    <son :car="car" @send-toy="toy = $event" v-bind="{x:666, y:777}"/>
  </div>
</template>

<script setup lang="ts">
  import son from '@/components/test/_9/son.vue';
  import {ref} from "vue";
  const car = ref('车车');
  const toy = ref('');
  function getToy(value : string) {
    toy.value = value;
  }
</script>

<script lang="ts">
/**
 * @Author Rin_pu
 * @Date 2025/2/20 20:10
 * @Description father
 * @todo
 */
export default {
  name: "father.vue"
}
</script>

<style scoped>
  .father {
    background-color: gray;
    margin: 10px;
    width: 800px;
    height: 500px;
  }
</style>